package level;

import pulpcore.sprite.Sprite;
import pulpcore.image.CoreGraphics;
import pulpcore.image.Colors;
import pulpcore.Stage;
import pulpcore.animation.Fixed;
import org.jbox2d.common.Vec2;
import goliath.BasicDemo;

/**
 * A faint line that shows the height of the highest stacked block.
 * @author will
 * @date Aug 10, 2008 6:36:36 PM
 */
public class StackHeightLine extends Sprite {

    public Fixed point = new Fixed(Float.NEGATIVE_INFINITY);
    public Boolean moving;

    public StackHeightLine() {
        super(0,0, Stage.getWidth(),Stage.getHeight());
        moving = false;
    }

    public void update(int elapsedTime) {
        float y = BasicDemo.getPhysics().getCanvasVector(new Vec2(0,(float)point.get())).y;
        this.setLocation(0,y);
    }
    public static final int RED = Colors.rgba(Colors.RED,100);
    public static final int GREEN = Colors.rgba(Colors.GREEN,100);
    protected void drawSprite(CoreGraphics g) {
        g.setColor(moving ? RED : GREEN);
        g.drawLine(0,0,Stage.getWidth(),0);
    }
}
